<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!-- Meta, title, CSS, favicons, etc. -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">

<title>随便打TCS系统</title>
<!-- Bootstrap -->
<link href="<%=basePath%>vendors/bootstrap/dist/css/bootstrap.min.css"
	rel="stylesheet">
<!-- Font Awesome -->
<link
	href="//netdna.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"
	rel="stylesheet">
<!-- NProgress -->
<link href="<%=basePath%>vendors/nprogress/nprogress.css"
	rel="stylesheet">
<!-- iCheck -->
<link href="<%=basePath%>vendors/iCheck/skins/flat/green.css"
	rel="stylesheet">

<!-- bootstrap-progressbar -->
<link
	href="<%=basePath%>vendors/bootstrap-progressbar/css/bootstrap-progressbar-3.3.4.min.css"
	rel="stylesheet">
<!-- JQVMap -->
<link href="<%=basePath%>vendors/jqvmap/dist/jqvmap.min.css"
	rel="stylesheet" />
<!-- bootstrap-daterangepicker -->
<link
	href="<%=basePath%>vendors/bootstrap-daterangepicker/daterangepicker.css"
	rel="stylesheet">

<!-- Custom Theme Style -->
<link href="<%=basePath%>build/css/custom.min.css" rel="stylesheet">
</head>
<%@ include file="loginCheck.jsp"%>
<body class="nav-md">
	<div class="container body">
		<div class="main_container">
			<div class="col-md-3 left_col">
				<div class="left_col scroll-view">
					<div class="clearfix"></div>
					<br />
				</div>
			</div>
			<!-- page content -->
			<div class="right_col" role="main">
				<div class="">
					<div class="page-title">
						<div class="title_left">
							<h3>轮播广告</h3>
						</div>
						<div class="title_right"></div>
					</div>
					<div class="clearfix"></div>
					<div class="row">
						<div class="col-md-12">
							<div class="x_panel">
								<div class="x_title">
									<h2>查看所有轮播广告信息</h2>
									<ul class="nav navbar-right panel_toolbox">
										<li><a class="collapse-link"> <i
												class="fa fa-chevron-up"></i>
										</a></li>
										<li class="dropdown"><a href="#" class="dropdown-toggle"
											data-toggle="dropdown" role="button" aria-expanded="false">
												<i class="fa fa-wrench"></i>
										</a>
											<ul class="dropdown-menu" role="menu">
												<li><a href="#">Settings 1</a></li>
												<li><a href="#">Settings 2</a></li>
											</ul></li>
										<li><a class="close-link"> <i class="fa fa-close"></i>
										</a></li>
									</ul>
									<div class="clearfix"></div>
								</div>
								<div class="x_content">
									<p>
										<input type="submit" class="btn btn-success"
											onclick="addCarousel()" value="添加广告" />
									</p>
									<p>启动页</p>
									<div class="row">
										<c:forEach items="${adsList}" var="s" varStatus="z">
											<c:if test="${s.adtype == 1}">
												<div class="col-md-55">
													<div class="thumbnail">
														<div class="image view view-first">
															<img style="width: 100%; display: block;" src="${s.path}"
																alt="image" data-action="zoom" />
															<div class="mask">
																<p></p>
																<div class="tools tools-bottom">
																	<a href="#" onclick="updateUrl('${s.id}','${s.url }')">
																		<i class="fa fa-link"></i>
																	</a> <a href="#" onclick="updateCarousel('${s.id}');">
																		<i class="fa fa-pencil"></i>
																	</a> <a href="#" onclick="updateType('${s.id}')"> <i
																		class="fa fa-times"></i></a>
																</div>
															</div>
														</div>
														<div class="caption">
															<p>${s.url}</p>
														</div>
													</div>
												</div>
											</c:if>
										</c:forEach>
									</div>
									<p>拨号等待页</p>
									<div class="row">
										<c:forEach items="${adsList}" var="s" varStatus="z">
											<c:if test="${s.adtype == 2}">
												<div class="col-md-55">
													<div class="thumbnail">
														<div class="image view view-first">
															<img style="width: 100%; display: block;" src="${s.path}"
																alt="image" />
															<div class="mask">
																<p></p>
																<div class="tools tools-bottom">
																	<a href="#" onclick="updateUrl('${s.id}','${s.url }')">
																		<i class="fa fa-link"></i>
																	</a> <a href="#" onclick="updateCarousel('${s.id}');">
																		<i class="fa fa-pencil"></i>
																	</a> <a href="#" onclick="updateType('${s.id}')"> <i
																		class="fa fa-times"></i></a>
																</div>
															</div>
														</div>
														<div class="caption">
															<p>${s.url}</p>
														</div>
													</div>
												</div>
											</c:if>
										</c:forEach>
									</div>
									<p>拨号键盘页</p>
									<div class="row">
										<c:forEach items="${adsList}" var="s" varStatus="z">
											<c:if test="${s.adtype == 3}">
												<div class="col-md-55">
													<div class="thumbnail">
														<div class="image view view-first">
															<img style="width: 100%; display: block;" src="${s.path}"
																alt="image" />
															<div class="mask">
																<p></p>
																<div class="tools tools-bottom">
																	<a href="#" onclick="updateUrl('${s.id}','${s.url }')">
																		<i class="fa fa-link"></i>
																	</a> <a href="#" onclick="updateCarousel('${s.id}');">
																		<i class="fa fa-pencil"></i>
																	</a> <a href="#" onclick="updateType('${s.id}')"> <i
																		class="fa fa-times"></i></a>
																</div>
															</div>
														</div>
														<div class="caption">
															<p>${s.url}</p>
														</div>
													</div>
												</div>
											</c:if>
										</c:forEach>
									</div>
									<p>加油页</p>
									<div class="row">
										<c:forEach items="${adsList}" var="s" varStatus="z">
											<c:if test="${s.adtype == 4}">
												<div class="col-md-55">
													<div class="thumbnail">
														<div class="image view view-first">
															<img style="width: 100%; display: block;" src="${s.path}"
																alt="image" />
															<div class="mask">
																<p></p>
																<div class="tools tools-bottom">
																	<a href="#" onclick="updateUrl('${s.id}','${s.url }')">
																		<i class="fa fa-link"></i>
																	</a> <a href="#" onclick="updateCarousel('${s.id}');">
																		<i class="fa fa-pencil"></i>
																	</a> <a href="#" onclick="updateType('${s.id}')"> <i
																		class="fa fa-times"></i></a>
																</div>
															</div>
														</div>
														<div class="caption">
															<p>${s.url}</p>
														</div>
													</div>
												</div>
											</c:if>
										</c:forEach>
									</div>
									<p>登录注册页</p>
									<div class="row">
										<c:forEach items="${adsList}" var="s" varStatus="z">
											<c:if test="${s.adtype == 5}">
												<div class="col-md-55">
													<div class="thumbnail">
														<div class="image view view-first">
															<img style="width: 100%; display: block;" src="${s.path}"
																alt="image" />
															<div class="mask">
																<p></p>
																<div class="tools tools-bottom">
																	<a href="#" onclick="updateUrl('${s.id}','${s.url }')">
																		<i class="fa fa-link"></i>
																	</a> <a href="#" onclick="updateCarousel('${s.id}');">
																		<i class="fa fa-pencil"></i>
																	</a> <a href="#" onclick="updateType('${s.id}')"> <i
																		class="fa fa-times"></i></a>
																</div>
															</div>
														</div>
														<div class="caption">
															<p>${s.url}</p>
														</div>
													</div>
												</div>
											</c:if>
										</c:forEach>
									</div>
									<%--<p>话费充值页</p>--%>
									<%--<div class="row">--%>
										<%--<c:forEach items="${adsList}" var="s" varStatus="z">--%>
											<%--<c:if test="${s.adtype == 6}">--%>
												<%--<div class="col-md-55">--%>
													<%--<div class="thumbnail">--%>
														<%--<div class="image view view-first">--%>
															<%--<img style="width: 100%; display: block;" src="${s.path}"--%>
																<%--alt="image" />--%>
															<%--<div class="mask">--%>
																<%--<p></p>--%>
																<%--<div class="tools tools-bottom">--%>
																	<%--<a href="#" onclick="updateUrl('${s.id}','${s.url }')">--%>
																		<%--<i class="fa fa-link"></i>--%>
																	<%--</a> <a href="#" onclick="updateCarousel('${s.id}');">--%>
																		<%--<i class="fa fa-pencil"></i>--%>
																	<%--</a> <a href="#" onclick="updateType('${s.id}')"> <i--%>
																		<%--class="fa fa-times"></i></a>--%>
																<%--</div>--%>
															<%--</div>--%>
														<%--</div>--%>
														<%--<div class="caption">--%>
															<%--<p>${s.url}</p>--%>
														<%--</div>--%>
													<%--</div>--%>
												<%--</div>--%>
											<%--</c:if>--%>
										<%--</c:forEach>--%>
									<%--</div>--%>
									<p>通讯录页</p>
									<div class="row">
										<c:forEach items="${adsList}" var="s" varStatus="z">
											<c:if test="${s.adtype == 7}">
												<div class="col-md-55">
													<div class="thumbnail">
														<div class="image view view-first">
															<img style="width: 100%; display: block;" src="${s.path}"
																alt="image" />
															<div class="mask">
																<p></p>
																<div class="tools tools-bottom">
																	<a href="#" onclick="updateUrl('${s.id}','${s.url }')">
																		<i class="fa fa-link"></i>
																	</a> <a href="#" onclick="updateCarousel('${s.id}');">
																		<i class="fa fa-pencil"></i>
																	</a> <a href="#" onclick="updateType('${s.id}')"> <i
																		class="fa fa-times"></i></a>
																</div>
															</div>
														</div>
														<div class="caption">
															<p>${s.url}</p>
														</div>
													</div>
												</div>
											</c:if>
										</c:forEach>
									</div>
									<%--<p>充值购物页</p>--%>
									<%--<div class="row">--%>
										<%--<c:forEach items="${adsList}" var="s" varStatus="z">--%>
											<%--<c:if test="${s.adtype == 8}">--%>
												<%--<div class="col-md-55">--%>
													<%--<div class="thumbnail">--%>
														<%--<div class="image view view-first">--%>
															<%--<img style="width: 100%; display: block;" src="${s.path}"--%>
																<%--alt="image" />--%>
															<%--<div class="mask">--%>
																<%--<p></p>--%>
																<%--<div class="tools tools-bottom">--%>
																	<%--<a href="#" onclick="updateUrl('${s.id}','${s.url }')">--%>
																		<%--<i class="fa fa-link"></i>--%>
																	<%--</a> <a href="#" onclick="updateCarousel('${s.id}');">--%>
																		<%--<i class="fa fa-pencil"></i>--%>
																	<%--</a> <a href="#" onclick="updateType('${s.id}')"> <i--%>
																		<%--class="fa fa-times"></i></a>--%>
																<%--</div>--%>
															<%--</div>--%>
														<%--</div>--%>
														<%--<div class="caption">--%>
															<%--<p>${s.url}</p>--%>
														<%--</div>--%>
													<%--</div>--%>
												<%--</div>--%>
											<%--</c:if>--%>
										<%--</c:forEach>--%>
									<%--</div>--%>
									<p>拨号结束页</p>
									<div class="row">
										<c:forEach items="${adsList}" var="s" varStatus="z">
											<c:if test="${s.adtype == 9}">
												<div class="col-md-55">
													<div class="thumbnail">
														<div class="image view view-first">
															<img style="width: 100%; display: block;" src="${s.path}"
																 alt="image" />
															<div class="mask">
																<p></p>
																<div class="tools tools-bottom">
																	<a href="#" onclick="updateUrl('${s.id}','${s.url }')">
																		<i class="fa fa-link"></i>
																	</a> <a href="#" onclick="updateCarousel('${s.id}');">
																	<i class="fa fa-pencil"></i>
																</a> <a href="#" onclick="updateType('${s.id}')"> <i
																		class="fa fa-times"></i></a>
																</div>
															</div>
														</div>
														<div class="caption">
															<p>${s.url}</p>
														</div>
													</div>
												</div>
											</c:if>
										</c:forEach>
									</div>
									<p>旅游页</p>
									<div class="row">
										<c:forEach items="${adsList}" var="s" varStatus="z">
											<c:if test="${s.adtype == 10}">
												<div class="col-md-55">
													<div class="thumbnail">
														<div class="image view view-first">
															<img style="width: 100%; display: block;" src="${s.path}"
																 alt="image" />
															<div class="mask">
																<p></p>
																<div class="tools tools-bottom">
																	<a href="#" onclick="updateUrl('${s.id}','${s.url }')">
																		<i class="fa fa-link"></i>
																	</a> <a href="#" onclick="updateCarousel('${s.id}');">
																	<i class="fa fa-pencil"></i>
																</a> <a href="#" onclick="updateType('${s.id}')"> <i
																		class="fa fa-times"></i></a>
																</div>
															</div>
														</div>
														<div class="caption">
															<p>${s.url}</p>
														</div>
													</div>
												</div>
											</c:if>
										</c:forEach>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>

	<script type="text/javascript">
		function addCarousel() {
			location.href = "carousel_add";
		}

		function updateCarousel(id) {
			location.href = "carousel_update?id=" + id;
		}

		function updateUrl(id, url) {
			layui.use([ 'layer', 'form' ], function() {
				var layer = layui.layer, form = layui.form;
				layer.prompt({
					title : '跳转地址(是否修改)',
					value : url,
					formType : 3
				}, function(url) {
					$.ajax({
						type : 'POST',
						url : 'carousel_do_update',
						data : {
							id : id,
							url : url
						},
						dataType : 'json',
						success : function(date) {
							switch (date) {
							case -1:
								alert("登录超时，请重新登录");
								top.location.href = "login/${titleId}";
								break;
							case 1:
								alert("修改成功");
								location.href = "carousel_index";
								break;
							default:
								alert("修改失败，请重新操作");
								break;
							}
						}
					});
				});
			});
		}

		function updateType(id) {
			if (!confirm("确认要删除吗，此操作不可撤销")) {
				return false;
			}
			$.ajax({
				type : 'POST',
				url : 'carousel_do_update',
				data : {
					id : id,
					datastatus : false
				},
				dataType : 'json',
				success : function(date) {
					switch (date) {
					case -1:
						alert("登录超时，请重新登录");
						top.location.href = "login/${titleId}";
						break;
					case 1:
						alert("删除成功");
						location.href = "carousel_index";
						break;
					default:
						alert("删除失败，请重新操作");
						break;
					}
				}
			});
		}
	</script>

	<!-- jQuery -->
	<script src="<%=basePath%>vendors/jquery/dist/jquery.min.js"></script>
	<!-- Bootstrap -->
	<script src="<%=basePath%>vendors/bootstrap/dist/js/bootstrap.min.js"></script>
	<!-- FastClick -->
	<script src="<%=basePath%>vendors/fastclick/lib/fastclick.js"></script>
	<!-- NProgress -->
	<script src="<%=basePath%>vendors/nprogress/nprogress.js"></script>
	<!-- bootstrap-daterangepicker -->
	<script src="<%=basePath%>vendors/moment/min/moment.min.js"></script>
	<script
		src="<%=basePath%>vendors/bootstrap-daterangepicker/daterangepicker.js"></script>
	<!-- Chart.js -->
	<script src="<%=basePath%>vendors/Chart.js/dist/Chart.min.js"></script>

	<!-- Custom Theme Scripts -->
	<script src="<%=basePath%>build/js/custom.min.js"></script>
	<!-- layui -->
	<script src="<%=basePath%>vendors/layui/layui.js"></script>
</body>
</html>